//Cone.cpp
//Contains the function definitions for the Cone Class

#include <iostream>
#include <math.h>
#include "Cone.h"

using namespace std;

Cone::Cone(const float &p_X, const float &p_Y, float rad, float hgt)
	: Circle(p_X, p_Y, rad)
{
	setHeight(hgt);
	setVol();
}

void Cone::setHeight(float hgt)
{
	if (hgt >= 0.0)
		height = hgt;
	else
		throw invalid_argument("The height must be greater than zero.");
}

float Cone::getHeight() const
{
	return height;
}

void Cone::setVol()
{
	CN_volume = (getHeight() * Circle::getArea()) / 3;
}

float Cone::getCnVol() const
{
	return CN_volume;
}

float Cone::volume() const
{
	return getCnVol();
}

